package com.shengsiyuan.nio;

import java.nio.ByteBuffer;

/**
 * Created by deng_wb on 2019/8/22
 * ByteBuffer类型化的get与put方法
 */
public class NioTest5 {
    public static void main(String[] args) {

        ByteBuffer buffer = ByteBuffer.allocate(64);

        buffer.putInt(5);
        buffer.putLong(500000000L);
        buffer.putDouble(14.1222222);
        buffer.putChar('你');
        buffer.putShort((short) 2);
        buffer.putChar('我');
        buffer.flip();

        System.out.println(buffer.getInt());
        System.out.println(buffer.getLong());
        System.out.println(buffer.getDouble());
        System.out.println(buffer.getChar());
        System.out.println(buffer.getShort());
        System.out.println(buffer.getChar());

    }
}
